package com.example.demo.controller;


import com.example.demo.dto.ResultJson;
import com.example.demo.entity.Rukujilu;
import com.example.demo.entity.Rukusunhuai;
import com.example.demo.mapper.Cangku_Mapper;
import com.example.demo.mapper.Rukusunhuai_Mapper;
import com.example.demo.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("Rukusunhuai")
public class Rukusunhuai_Controller extends BasicController<Rukusunhuai> {
	@Autowired
	Rukusunhuai_Mapper mapper;
	@Autowired
	Cangku_Mapper cangku_mapper;

	@Override
	public ResultJson insert(Rukusunhuai r) {

		int shuliang = r.getNumber();
		int id = r.getShangpinid();
		cangku_mapper.jianshaoshuliang(id,shuliang);
		r.setTime(DateUtils.getNowTime());
		return super.insert(r);
	}



}
